package com.fenghuajueli.libbasecoreui.recycler

import android.view.View

fun View.show() {
    visibility = View.VISIBLE
}

fun View.hide() {
    visibility = View.GONE
}

fun View.invisible() {
    visibility = View.INVISIBLE
}

private var lasTime = 0L
private const val TIME_INTERVER = 500
fun View.setOnFastClickListener(timeInterver:Int = TIME_INTERVER, onClick: (view:View) -> Unit) {
    setOnClickListener {
        val timeDiff = System.currentTimeMillis() - lasTime
        val b = timeDiff <= timeInterver
        if (b) {
            return@setOnClickListener
        }
        lasTime = timeDiff
        onClick.invoke(this)
    }

}